package cn.gson.crm.model.pojos;

import javax.persistence.*;
import java.sql.Time;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "Check_", schema = "CRM", catalog = "")
public class Check {
    private Integer checkId;
    private String checkType;
    private Date checkDate;
    private Date checkspDate;
    private Long checkStaff;//员工编号
    private long checkName;
    private String checkCondition;
    private String checkDan;
    private int checktypeid;
    private long checksqinName;
    private Employee employeeByYgId;
    private Sell sell;
    private Business business;
    private Contract contract;
    private Offer offer;
    private Order order;
    private ReturnGoods returnGoods;
    private ExchangeGoods exchangeGoods;

    @Id
    @Column(name = "CHECK_ID")
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public Integer getCheckId() {
        return checkId;
    }

    public void setCheckId(Integer checkId) {
        this.checkId = checkId;
    }

    @Basic
    @Column(name = "CHECK_SQINNAME")
    public long getChecksqinName() {
        return checksqinName;
    }

    public void setChecksqinName(long checksqinName) {
        this.checksqinName = checksqinName;
    }

    @Basic
    @Column(name = "CHECK_DAN")
    public String getCheckDan() {
        return checkDan;
    }

    public void setCheckDan(String checkDan) {
        this.checkDan = checkDan;
    }

    @Basic
    @Column(name = "CHECK_SPDATE")
    public Date getCheckspDate() {
        return checkspDate;
    }

    public void setCheckspDate(Date checkspDate) {
        this.checkspDate = checkspDate;
    }
    @Basic
    @Column(name = "CHECK_TYPEID")
    public int getChecktypeid() {
        return checktypeid;
    }

    public void setChecktypeid(int checktypeid) {
        this.checktypeid = checktypeid;
    }


    @Basic
    @Column(name = "CHECK_TYPE")
    public String getCheckType() {
        return checkType;
    }

    public void setCheckType(String checkType) {
        this.checkType = checkType;
    }

    @Basic
    @Column(name = "CHECK_DATE")
    public Date getCheckDate() {
        return checkDate;
    }

    public void setCheckDate(Date checkDate) {
        this.checkDate = checkDate;
    }

    @Basic
    @Column(name = "CHECK_STAFF")
    public Long getCheckStaff() {
        return checkStaff;
    }

    public void setCheckStaff(Long checkStaff) {
        this.checkStaff = checkStaff;
    }

    @Basic
    @Column(name = "CHECK_NAME")
    public long getCheckName() {
        return checkName;
    }

    public void setCheckName(long checkName) {
        this.checkName = checkName;
    }

    @Basic
    @Column(name = "CHECK_CONDITION")
    public String getCheckCondition() {
        return checkCondition;
    }

    public void setCheckCondition(String checkCondition) {
        this.checkCondition = checkCondition;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_STAFF",insertable = false,updatable = false)
    public Employee getEmployeeByYgId() {
        return employeeByYgId;
    }

    public void setEmployeeByYgId(Employee employeeByYgId) {
        this.employeeByYgId = employeeByYgId;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_TYPEID",insertable = false,updatable = false)
    public Business getBusiness() {
        return business;
    }

    public void setBusiness(Business business) {
        this.business = business;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_TYPEID",insertable = false,updatable = false)
    public Contract getContract() {
        return contract;
    }

    public void setContract(Contract contract) {
        this.contract = contract;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_TYPEID",insertable = false,updatable = false)
    public Offer getOffer() {
        return offer;
    }

    public void setOffer(Offer offer) {
        this.offer = offer;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_TYPEID",insertable = false,updatable = false)
    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_TYPEID",insertable = false,updatable = false)
    public ReturnGoods getReturnGoods() {
        return returnGoods;
    }

    public void setReturnGoods(ReturnGoods returnGoods) {
        this.returnGoods = returnGoods;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_TYPEID",insertable = false,updatable = false)
    public ExchangeGoods getExchangeGoods() {
        return exchangeGoods;
    }

    public void setExchangeGoods(ExchangeGoods exchangeGoods) {
        this.exchangeGoods = exchangeGoods;
    }

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},optional=false)
    @JoinColumn(name = "CHECK_TYPEID",insertable = false,updatable = false)
    public Sell getSell() {
        return sell;
    }

    public void setSell(Sell sell) {
        this.sell = sell;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Check check = (Check) o;
        return checkId == check.checkId &&
                Objects.equals(checkType, check.checkType) &&
                Objects.equals(checkDate, check.checkDate) &&
                Objects.equals(checkspDate, check.checkspDate) &&
                Objects.equals(checkStaff, check.checkStaff) &&
                Objects.equals(checkName, check.checkName) &&
                Objects.equals(checkDan, check.checkDan) &&
                Objects.equals(checktypeid, check.checktypeid) &&
                Objects.equals(checkCondition, check.checkCondition);
    }

    @Override
    public int hashCode() {
        return Objects.hash(checkId, checkType, checkDate, checkStaff, checkName, checkCondition,checktypeid,checkDan);
    }


}
